Creating and Running a Database Application Using Oracle Application Express 5.0


Options



Last updated: 04/17/15 01:30 pm EDT

Before You Begin

Purpose

This tutorial shows you how to rapidly create a database application using Oracle Application Express.

Time to Complete

Approximately 80 minutes.

Prerequisites

Before starting this tutorial, you should have:

Creating a Database Application

To create a database application with a few initial pages, perform the following steps:

  1. From the Oracle Application Express home page, click the down arrow next to Application Builder tab and select Applications > Database Applications.


    alt description here
  2. Click Create >.

    alt description here
  3. For Name, enter Project Tasks Application . Click Next >.

    alt description here
  4. Click Next.

    alt description here
  5. Click Next.

    alt description here
  6. Slect DD-MON-YYYY for Date Format.

    alt description here
  7. Click Create Application .

    alt description here
  8. Click Create Page .

    alt description here
  9. Click Form >Master Detail Form

    alt description here
    alt description here
  10. On Create Master Detail window, Select OBE_PROJECTS for Table/View name. Click Next

    alt description here
  11. For Show Only Related Tables select No. For Table/View name select OBE_TASKS. Move and select all columns . Click Next

    alt description here
  12. For Master table > Primary Key Type choose Select Primary Key Column(s). Also for Detail table> Primary Key Type choose Select Primary Key Column(s). Click Next

    alt description here
  13. For Primary Key Source choose Existing trigger . Click Next

    alt description here
  14. For Primary Key Source choose Existing trigger . Click Next

    alt description here
  15. For Master Row Navigation Order select PROJECT_ID . Click Next

    alt description here
  16. Accept the default and click Next.

    alt description here
  17. Click Next.

    alt description here
  18. For Navigation Preference choose Create a new navigation menu entry. For Parent Navigation Menu Entry select Home. Click Next.

    alt description here
  19. Click Create .
    alt description here
  20. Your page was created successfully. Click Save and Run.

    alt description here
  21. Enter OBE for the Username and OBE for the Password. Then click Login.
    alt description here
  22. A report containing the list of projects is automatically created. Select the Edit ( )icon next to one of the projects to view the Master detail Form.
    alt description here
  23. The Master Detail Form is shown. This page allows a user to edit the details of the Project as well as the details of the Tasks associated with the Project. It also allows users to add new tasks to the current project.

    In the master region, you can use the backward( )and forward ( )buttons to move to previous and next projects. For example, if you have clicked the edit icon next to the Public Website project in the previous step, you see a backward button here.

    In the detail region, you see an Add Row button. This button saves any pending changes and then adds another row so that a new task can be added to the project. You should also have a Delete Checked button. This button is used in conjunction with the check boxes to the left of each Task. When you click the Delete Checked button, any tasks that have been "checked" are deleted. If you use this feature, you notice that a deletion confirmation has been built in. This asks you to confirm your deletion before proceeding.

    Change the name of the project and click Save.

    alt description here

Editing Application Objects

Although the Master-Detail form is fully functional, the presentation can be improved. In this topic you change the names of the Page Title, Region Title and change the format an item on the Master Report. Lastly, you change the sequence of items in the Projects and Tasks page using the Drag and Drop feature. Perform the following steps:


  1. Click Edit Page 2.

    alt description here


  2. In the Rendering section of the Page Designer, locate and expand Obe Projects > Columns node.

    alt description here
  3. Click PROJECT_DEADLINE.

    alt description here
  4. In the Column - Appearance section of the Page Designer, click Format Mask.

    alt description here
  5. From the Pick Format Mask page, select 12-JAN-2004.

    alt description here
  6. Click Save.

    alt description here
  7. In the Rendering section, click Page 2: OBE_PROJECTS.

    alt description here


  8. Change the Name and Title to PROJECTS.

    alt description here
  9. Click Save and Run Page icon.

    alt description here
  10. Click Quick Edit on the Developer toolbar.

    alt description here


  11. Click Obe Projects.

    alt description here
  12. You are taken to the Page Designer with Obe Projects selected. In the Rendering section notice that Obe Projects is selected.

    alt description here
  13. In the Region section of Page Designer, change Title to PROJECTS and click Save.

    alt description here
  14. Click Save and Run Page.

    alt description here
  15. If you want to add help text for any item labels , Click Edit page3.

    alt description here
  16. In the Page Rendering section of Page Designer, click P3_PROJECT.

    alt description here
  17. In the Property Editor - Page Item section of Page Designer, click Edit in Modal button for Help property.

    alt description here
  18. Change the Help Text to something else and click OK.

    alt description here
  19. Click Save and Run Page.

    alt description here
  20. Click ? next to Project label and notice that your help text is displayed.

    alt description here
  21. You can reorder the items on your page. Click Edit Page 3.

    alt description here
  22. The page definition for Page 3 is displayed. To reorder the sequencing of items in this page, you can drag and drop an item to a new location. Drag and drop the P3_PROJECT_PRIORITY item above the P3_PROJECT_ DEADLINE item and release your mouse.

    alt description here
  23. Click Save.

    alt description here
  24. Click Save and Run.

    alt description here
  25. Note how the Project Priority field now appears above the Project Deadline field. Click the Application<n> link in the developer tool bar.

    alt description here

Creating List of Values(LOVs)

Another way to improve the presentation of the application is to create a List of Values. In this topic, you create the following LOVs:

EMPLOYEES A Dynamic LOV to show the list of Employees. This LOV is then associated with the Assigned To column in the List of Tasks.
STATUSES A Static LOV to show the list of Statuses. This LOV is then associated with the Status column in the List of Tasks.
PRIORITIES A Static LOV to show the list of Priorities. This LOV is then associated with the Priority column in the Projects Master area.
  1. Click the 3 - Master Detail page.

    alt description here
  2. Click Shared Components icon in the Page Designer.

    alt description here
  3. In the Shared Components page, click List of Values.

    alt description here
  4. Click Create.

    alt description here
  5. Select From Scratch and click Next >.

    alt description here
  6. Enter EMPLOYEES for Name and select Dynamic for Type. Click Next >.

    alt description here
  7. Click Create Dynamic List of Values link.

    alt description here
  8. To select a Table, click the up arrow.

    alt description here
  9. Select OBE_EMPLOYEES.

    alt description here
  10. Click Next >.

    alt description here
  11. Enter FIRST_NAME for Display Column and EMPLOYEE_ID for Return Value.

    alt description here
  12. Concatenate LAST_NAME to the SQL statement for display value and click Finish. The first column in a dynamic list of values is the column displayed to the user. The second column is the corresponding value to be stored in the database. They can both be the same value when appropriate:
    select FIRST_NAME||', '||LAST_NAME as display_value, EMPLOYEE_ID as return_value from OBE_EMPLOYEES order by 1.

    alt description here
  13. Click Create List of Values.

    alt description here
  14. Your LOV was created. You want to create 2 more static LOVs. Click Create >.

    alt description here
  15. Select From Scratch and click Next >.

    alt description here
  16. Enter STATUSES for Name and select Static for Type. Click Next >.

    alt description here
  17. For Display Value and Return Value, enter the following:

    Display Value Return Value
    Closed closed
    Open open
    On Hold on-hold

    Click Create List of Values.
    alt description here
  18. The STATUSES LOV was created. There is one more LOV to create for the Master portion of the form, Priorities. Click Create

    alt description here
  19. Select From Scratch and click Next >.

    alt description here
  20. Enter PRIORITIES for Name and select Static for Type. Click Next >.

    alt description here
  21. For Display Value and Return Value, enter the following:

    Display Value Return Value
    High 1
    Medium 2
    Low 3

    Click Create List of Values.
    alt description here
  22. Click Edit Page 3 icon.

    alt description here
  23. In the Page Rendering section, under Obe Tasks, expand Columns.

    alt description here
  24. Click ASSIGNED_TO.

    alt description here
  25. In the Column section of Page Designer, select Type as Select List.

    alt description here
  26. Scroll down the Property Editor and select Type for List of Values as Shared Component.

    alt description here
  27. Select List of Values as EMPLOYEES.

    alt description here
  28. Click Save.

    alt description here
  29. In the Rendering section, click STATUS under Obe Tasks.

    alt description here
  30. In the Column section of Page Designer, select Type as Radio Group.

    alt description here
  31. Scroll down the Property Editor and select Type for List of Values as Shared Component.

    alt description here
  32. Select List of Values as STATUSES.

    alt description here
  33. Click Save.

    alt description here
  34. Click Save and Run Page.

    alt description here
  35. Select the drop down list for Assigned To. You see that the dynamic LOV executed and the list of Employees is shown.

    alt description here
  36. Next, you need to assign the the PRIORITIES LOV to the Priority item in the Master area of the page. Click Edit Page 3.

    alt description here
  37. In the Page Rendering section, click P3_PROJECT_PRIORITY under Obe Tasks.

    alt description here
  38. In the Property Editor - Page Item section of Page Designer, select Type as Radio Group.

    alt description here
  39. Scroll down the Property Editor and select Type for List of Values as Shared Component and select List of Values as PRIORITIES.

    alt description here
  40. Click Save and Run Page.

    alt description here
  41. The Priority field is now a Radiogroup populated with the LOV values. Click Edit Page 3 in the Developer links.

    alt description here

Adding an Item Validation

You don't want a user entering a date prior to today's date. This type of check can be done through an item validation. Perform the following steps:

  1. In the Page Designer section for Page 3, click Processing.

    alt description here

  2. Right-click Validations and select Create Validation.

    alt description here
  3. In the Validation section, enter P3_PROJECT_DEADLINE greater than today as Validation Name. Select PL/SQL Expression for Type.

    alt description here
  4. Enter TO_DATE(:P3_PROJECT_DEADLINE,'DD-MM-YYYY') >= SYSDATE for the PL/SQL Expression and Date needs to be greater than today for the Error Message.

    alt description here
  5. Select the item P3_PROJECT_DEADLINE for the Associated Item. Then select SAVE for When Button Pressed.


    alt description here
  6. Click Save.

    alt description here
  7. Click Run.

    alt description here
  8. Change the date to something prior to today's date and click Save.

    alt description here
  9. Notice that you receive an item (or field) error message as well as a page notification message. This is because you specified that you wanted both when you created the validation.

    alt description here
  10. Click the Application<n> link in the developer tool bar.

    alt description here

Want to Learn More?

In this tutorial, you learned how to:
  • Create a Database Application
  • Edit Application Objects
  • Create List of Values
  • Add an Item Validation

Resources

Credits

  • Lead Curriculum Developer: Dimpi Sarmah

  • Other Contributors:David Peake,Anupama Mandya